﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using WindowsGame1.GameMain;
using WindowsGame1.Interface;

namespace WindowsGame1.Windows
{
    class Menu : Canvas
    {
        public Menu(Game game)
        {
            Game = game;
            Width = Game.Window.ClientBounds.Width;
            Height = Game.Window.ClientBounds.Height;
            Buttons = new Botoes();
        }

        public override void LoadContent(ContentManager content)
        {
            Buttons.Add(new clsButton(content.Load<Texture2D>(@"Menu\start2"),
                                    content.Load<Texture2D>(@"Menu\start2"),
                                    new Vector2(Width / 2-135, Height / 2 - 40), new Vector2(170, 70),
                                    delegate { ((Core)Game).LoadGame(); }));

            Buttons.Add(new clsButton(content.Load<Texture2D>(@"Menu\exit2"),
                                   content.Load<Texture2D>(@"Menu\exit2"),
                                   new Vector2(Width / 2-135, Height / 2 + 40), new Vector2(170, 70),
                                   delegate { Game.Exit(); }));

            //Background = content.Load<Texture2D>(@"Menu\Background");
        }

        public override void Update(GameTime gameTime)
        {
            Buttons.Update();
        }

        public override void Render(SpriteBatch renderTarget)
        {
            //renderTarget.Draw(Background, new Rectangle(0, 0, Width, Height), Color.White);
            Buttons.Draw(renderTarget);
        }
    }
}
